package com.moshang.blog.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.moshang.blog.entity.SysUserRole;
import com.moshang.blog.mapper.SysUserRoleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import com.moshang.blog.service.SysUserRoleService;

import javax.annotation.Resource;
import java.util.List;


@Service("sysUserRoleService")
public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole> implements SysUserRoleService {

     @Resource
     private SysUserRoleMapper sysUserRoleMapper;
    @Override
    public List<SysUserRole> findByUserId(Integer id) {
        QueryWrapper<SysUserRole> entityWrapper=new QueryWrapper<>();
        entityWrapper.eq("user_id",id);
        List<SysUserRole> list=baseMapper.selectList(entityWrapper);
        return list;
    }

    @Override
    public void deleteByIds(List<Integer> idList) {
            baseMapper.deleteBatchIds(idList);
    }

    @Override
    public List<Integer> findByRoleId(Integer roleId) {

        return sysUserRoleMapper.findByRoleId(roleId);
    }
}
